﻿<%@ Page Title="Retail Sales Invoice" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="ARInvoice.aspx.cs" Inherits="VSM.ARInvoice" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function isNumberKey(sender, evt) {
            var txt = sender.value;
            var dotcontainer = txt.split('.');
            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57))
                return false;
            return true;
        }

        function OpenItemPopup() {
            //var customer = $("#<%= txtCustomerCode.ClientID %>").val();
            var url = "../../ItemPopup.aspx?itmgrp=104";
            Main.openCustomDialog(url, 600, 610, "Accessories - Item Master Data");
        }

        function OpenBP() {
            var url = "../../BPPopup.aspx?CardType=C";
            Main.openCustomDialog(url, 600, 610, "Business Partner List");
        }

        function OpenDocList(docktype, title, status) {
            var url = "../../DocumentList.aspx?DocType=" + docktype + "&Status=" + status
            Main.openCustomDialog(url, 800, 610, title);
        }

        function OpenOSRI(itemCode, whsCode) {
            var url = "../../SerialNumberPopup.aspx?ItemCode=" + itemCode;
            url += "&WhsCode=" + whsCode;
            Main.openCustomDialog(url, 800, 610, "VIN Number List");
        }

    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hdnIsUpdate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <asp:HiddenField ID="hdnBaseType" runat="server" />
                <h2>
                    &nbsp;<asp:Label ID="lblTitle" runat="server" Text="Retail Sale Invoice"></asp:Label>
                </h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Document No:</td>
                            <td style="width: 150px">
                                <asp:TextBox ID="txtDocNo" Width="100px" runat="server" BackColor="#E6E6E6" 
                                    ReadOnly="True" ></asp:TextBox>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 100px;">Status:</td>
                            <td align="left">
                                <asp:Label ID="lblStatus" runat="server" Text="Open"></asp:Label>
                            </td>
                            <td align="right">
                                <asp:Button ID="btnDocList" runat="server" OnClientClick="OpenDocList('13', 'Retail Sales Invoice List', ''); return false;" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" Text="List" Width="60px" />
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 150px;">Posting Date:</td>
                            <td style="width: 150px">
                                <asp:TextBox ID="txtPostingDate" Width="100px" runat="server"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtPostingDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgPostingDate" 
                                    TargetControlID="txtPostingDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPostingDate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <asp:Label ID="lblPosDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Due Date:</td>
                            <td colspan="2">
                                <asp:TextBox ID="txtDueDate" Width="100px" runat="server" AutoPostBack="True" OnTextChanged="txtPODate_TextChanged"></asp:TextBox>
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yyyy" 
                                    PopupButtonID="imgDueDate" TargetControlID="txtDueDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgDueDate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <asp:Label ID="lblDueDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                          <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Document Date:</td>
                          <td>
                              <asp:TextBox ID="txtDocDate" Width="100px" runat="server"></asp:TextBox>
                              <cc1:CalendarExtender ID="txtDocDate_CalendarExtender" runat="server" 
                                Format="dd/MM/yyyy" PopupButtonID="imgDocDate" TargetControlID="txtDocDate">
                              </cc1:CalendarExtender>
                              <asp:ImageButton ID="imgDocDate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                              <asp:Label ID="lblDocDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Invoice No.:</td>
                            <td style="width:320px;">
                                <table width="100%">
                                    <tr>
                                        <td style="width:50%;">
                                            <asp:TextBox ID="txtInvNo" runat="server" Width="87%"></asp:TextBox>
                                            <asp:Label ID="lblInvoiceNoRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                                        </td>
                                        <td style="width:45%;text-align: right;border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                            <asp:Label ID="lblSeries" runat="server" Text="Series No.:" ></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td>
                                <asp:TextBox ID="txtSeriesNo" runat="server" Width="150px"></asp:TextBox>
                                <asp:Label ID="lblSeriesNoRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                        </tr>
                    </table>
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" style="white-space: nowrap; width: 150px;" valign="middle">
                                Customer:
                            </td>
                            <td class="FormLineItemAlt" >
                                <asp:TextBox ID="txtCustomerCode" runat="server" ReadOnly="True" Width="100px" 
                                    BackColor="#E6E6E6"></asp:TextBox>
                                <asp:TextBox ID="txtCustomerName" runat="server" Width="250px"></asp:TextBox>
                                <asp:Button ID="btnSelectCustomer" runat="server" OnClientClick="OpenBP(); return false;"
                                    Text="..." Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;
                                    font-weight: bold" Width="22px" />                            
                                <asp:Label ID="lblCustomerRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td class="FormLineItem" style="width: 50%;" rowspan="3">
                                <strong style="vertical-align:top;"> Bill To: </strong>
                                <asp:TextBox ID="txtBillTo" runat="server" Height="71px" TextMode="MultiLine" 
                                    Width="90%"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle" style="width: 150px;">
                                <asp:Label ID="lblConPersonName" runat="server">Contact Person:</asp:Label> 
                            </td>
                            <td class="FormLineItem" >
                                <asp:TextBox ID="txtContactPerson" runat="server" MaxLength="100" Width="250px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" colspan="2">
                                <asp:Button ID="btnAddItems" runat="server" Text="Add vehicle"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Width="100px" onclick="btnAddItems_Click" />
                                <asp:Button ID="btnAddAccessories" runat="server" Enabled="False" OnClientClick="OpenItemPopup();return false;" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" Text="Add accessories" Width="100px" />
                            </td>
                        </tr>
                    </table>
                    <hr />
                    <div style="width: 100%">
                        <asp:GridView ID="grvINV" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" HeaderStyle-VerticalAlign="Middle"
                            AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" 
                            PageSize="20" OnRowDataBound="grvSearchResult_RowDataBound">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" TabIndex="-1" OnClick="lnkDelete_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Model/ Product">
                                    <ItemStyle HorizontalAlign="Center" Width="170px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlModel" AutoPostBack="true" onselectedindexchanged="ddlModel_SelectedIndexChanged" 
                                            style="width: 98%;" runat="server">
                                        </asp:DropDownList>
                                        <asp:DropDownList ID="ddlProduct" AutoPostBack="true" onselectedindexchanged="ddlProduct_SelectedIndexChanged" 
                                            style="width: 98%;" runat="server">
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Color">
                                    <ItemStyle HorizontalAlign="Center" Width="180px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlColor" AutoPostBack="true" onselectedindexchanged="ddlColor_SelectedIndexChanged" style="width: 98%;" runat="server">
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Item Code" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemCode" runat="server" Text='<%# Bind("ItemCode") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Item Name">
                                    <ItemStyle HorizontalAlign="left" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderItemName" runat="Server" Text="Item Name" />
                                        <asp:label ID="lblItemNameRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="txtItemName" runat="server" Text='<%# Bind("Dscription") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Model" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Right" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtModel" runat="server" Text='<%# Bind("U_Model") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Product" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtProduct" runat="server" Text='<%# Bind("U_Product") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Color" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtCorlorCode" runat="server" Text='<%# Bind("U_Color") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Qty./ Unit price">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderQty" runat="Server" Text="Qty./ Unit price" />
                                        <asp:label ID="lblQtyRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtOrderQuantity" runat="server" Text='<%# Bind("Quantity")%>' OnTextChanged="txtOrderQuantity_OnTextChanged"
                                             Style="text-align: right; Width: 97%;" AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" />
                                        <asp:TextBox ID="txtUnitPrice" runat="server" Style="text-align: right; Width: 97%;" Text='<%# Bind("PriceBefDi") %>' 
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtUnitPrice_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="VIN Number">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" Width="170px" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkOSRI" runat="server" OnClick="lnkOSRI_Click" >
                                        <img src="../../skin/icon/link.png" alt="icon"/></asp:LinkButton>
                                        <asp:TextBox ID="txtDistNumber" runat="server" BackColor="Transparent" Readonly="true" Width="80%" 
                                            Style="text-align: center" Text='<%# Bind("DistNumber") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Total Before Disc.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtLineTotal" runat="server" Text='<%# Bind("LineTotal") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Disc. Amnt/ Incentive Disc.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtDiscount" runat="server" Width="97%" Style="text-align: right" AutoPostBack="true"
                                            Text='<%# Bind("U_Discount") %>' OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtDiscount_OnTextChanged" />
                                        <asp:TextBox ID="txtIncentiveDsc" runat="server" Width="97%" Style="text-align: right" AutoPostBack="true"
                                            Text='<%# Bind("U_IncentiveDiscount") %>'  OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtIncentiveDsc_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Total After Disc.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtTotalAfter" runat="server" Text='<%# Bind("TotalAfDisc") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Tax">
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlVatGroup" AutoPostBack="true" OnSelectedIndexChanged="ddlVatGroup_SelectedIndexChanged"  
                                            Style="width: 98%;" runat="server" />
                                        <asp:HiddenField ID="hdnVatGroup" Value='<%# Bind("VatGroup") %>' runat="server" />
                                        <asp:HiddenField ID="hdnVatPrcnt" Value='<%# Bind("VatPrcnt") %>' runat="server" />
                                        <asp:HiddenField ID="hdnVatSum" Value='<%# Bind("VatSum") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Warehouse">
                                    <ItemStyle HorizontalAlign="Center" Width="130px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlWhs" AutoPostBack="true" OnSelectedIndexChanged="ddlWhs_SelectedIndexChanged" 
                                            Style="width: 98%;" runat="server"  />
                                        <asp:HiddenField ID="hdnWhsCode" Value='<%# Bind("WhsCode") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Line Total">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtTotal" runat="server" Text='<%# Bind("Total") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                            </Columns>
                            <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all" cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <th>
                                            <span>Action</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                        <th>
                                            <span>Item Code</span>
                                        </th>
                                        <th>
                                            <span>Item Name</span>
                                        </th>
                                        <th>
                                            <span>Model</span>
                                        </th>
                                        <th>
                                            <span>UoM</span>
                                        </th>
                                        <th>
                                            <span>Order Qty.</span>
                                        </th>
                                        <th>
                                            <span>VIN Number</span>
                                        </th>
                                        <th>
                                            <span>Unit Price</span>
                                        </th>
                                        <th>
                                            <span>Discount (%)</span>
                                        </th>
                                        <th>
                                            <span>Line Total</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="12">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
                    <hr width="100%" />
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td valign="top" style="width: 70%;">
                            <table style="width: 100%;">
                                <tr>
                                    <td valign="top" style="width: 10%;">
                                        <strong>Remarks:</strong>
                                    </td>
                                    <td style="width: 50%;">
                                        <asp:TextBox style=" width: 98%;" runat="server" ID="txtRemarks" Height="71px" TextMode="MultiLine" ></asp:TextBox>
                                    </td>
                                    <td valign="top" style="width: 10%;">
                                        <strong>Sale Man:</strong>
                                    </td>
                                    <td valign="top" style="width: 30%;">
                                        <asp:DropDownList runat="server" style=" width: 100%;" ID="ddlSaleMan" TextMode="MultiLine" ></asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style="width: 30%; ">
                            <div style="margin-right: 1px;">
                                <table  width="100%" border="0">
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td style="width: 50%; " align="right">Total Before Discount:</td>
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblSubTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none;
                                        background-color: rgb(96, 149, 201);">
                                        <td align="right">Tax Amount:</td>
                                        <td style="width: 50%; " align="right">
                                            <asp:Label ID="lblTaxAmount" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; font-weight: bold; text-decoration: none;
                                        background-color: #D9E0ED;">
                                        <td style="width: 50%; " align="right">Total:</td>
                                        <td style="width: 50%; " align="right">
                                            <asp:Label ID="lblPaymentTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="margin-left: 5px; width: 99%;">
                                <hr />
                            </div>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 25%;">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnSave_Click" 
                                            BorderStyle="Solid" Width="60px" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" 
                                            OnClick="btnCancel_Click" Width="60px" />
                                        <asp:Button ID="btnPrint" runat="server" BorderStyle="Solid" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Export Invoice to xlsx" Width="130px" onclick="btnPrint_Click" />
                                        <asp:Button ID="btnLastRecord" runat="server" BorderStyle="Solid" 
                                            onclick="btnLastRecord_Click" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="&gt;&gt;" ToolTip="Last record" Width="40px" />
                                    </td>
                                    <td style="width: 55%;">
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                    <td style="width: 20%;" align="right">
                                        <asp:Button ID="btnCopyFromSO" runat="server" Text="Copy from SO" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" 
                                            OnClientClick="OpenDocList('17', 'Sales Order List', 'O'); return false;" 
                                            BorderStyle="Solid" Width="100px" />
                                        <asp:Button ID="btnCopyFromDO" runat="server" BorderStyle="Solid" 
                                            OnClientClick="OpenDocList('15', 'Delivery Order List', 'O'); return false;" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Copy from DO" Width="100px" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                 <asp:PostBackTrigger  ControlID="btnPrint" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
